public class Test1 {
    public static int firstUniqChar(String s) {
        int[] array = new int[26];
        for (int i = 0; i < s.length(); i++) {
            array[s.charAt(i) - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            if (array[s.charAt(i) - 'a'] == 1) {
                return i;
            }
        }
        return -1;
    }


    public static void main(String[] args) {
        String s = "acba";
        int ret = firstUniqChar(s);
        System.out.println(ret);
    }
}

